{-# LANGUAGE TypeOperators #-}
{- |
Module      :  Model.InterstellarExtinction
Description :  <optional short text displayed on contents page>
Copyright   :  (c) Sergey Sichevskiy 2012
License     :  BSD3

Maintainer  :  s.sichevskij@gmal.com
Stability   :  experimental
Portability :  portable

Модель закона межзвездного поглощения

-}

module Model.InterstellarExtinction
 ( model
 ) where

import Types
import Model
import Data.HList

import Control.Monad.Reader ( asks )
import Control.Applicative ( pure)

{--
--model :: Factory (Model Extinction)
--model :: Factory ( (Ebv ::: Null) ->  Extinction)
model_ :: Factory ( (Double ::: Null) -> (Ebv ::: Null), (Ebv ::: Null) ->  Extinction)
model_ = do
  ielaw <- asks $ extinction

--  let ext (Ebv x) = 10**(-0.4 * aie)
  let ext (Ebv x ::: Null) = 10**(-0.4 * aie)
       where
         aie = ielaw * ebv
         ebv = pure x

  let fm (x ::: Null) = (Ebv ebv ::: Null)
        where
          ebv = 3 * exp $ -(x*x)         

  return (fm, ext)
--}

model :: Factory ((Ebv ::: Null) ->  Extinction)
model = do
  ielaw <- asks $ extinction

  let ext (Ebv x ::: Null) = 10**(-0.4 * aie)
       where
         aie = ielaw * ebv
         ebv = pure x

  return ext
 